import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose'
import { HydratedDocument } from 'mongoose'

export type WorkflowTemplateDocument = HydratedDocument<WorkflowTemplate>

type flowData = {
  nodesData: any[]
  linesData: any[]
}

@Schema()
export class WorkflowTemplate {
  @Prop()
  public name: string

  @Prop({ type: String })
  public formData: string

  @Prop({ type: Object })
  public flowData: flowData
}

export const WorkflowTemplateSchema =
  SchemaFactory.createForClass(WorkflowTemplate)
